import service from '../utils/request.js'; // 引入二次封装的 axios

// 用户管理
export const getUserById = (id) => {
    return service.get(`/api/admin/user/detail/${id}`);
};
export const adduser = (user) => {
    return service.post(`/api/admin/user/add`,user);
};
export const deleteUserById = (id) => {
    return service.post(`/api/admin/user/delete/${id}`);
};
export const deleteUserGroup = (ids) => {
    return service.post(`/api/admin/user/batchDelete`,ids);
};
export const listUsers = (userPageDTO) => {
    return service.post('/api/admin/user/list', userPageDTO);
};

export const login = (userDTO) => {
    return service.post('/api/admin/user/login', userDTO);
};

export const registerUser = (registerUserDto) => {
    return service.post('/api/admin/user/register', registerUserDto);
};

export const updateUser = (user) => {
    return service.post('/api/admin/user/update', user);
};

export const getLoginerInfo = () => {
    return service.get('/api/admin/user/loginerInfo');
};

export const logout = () => {
    return service.post('/api/admin/user/logout');
};

// 新增忘记密码相关接口
export const verifyAccount = (param) => {
    return service.post('/api/admin/user/verifyAccount', param);
};

export const resetPassword = (param) => {
    return service.post('/api/admin/user/resetPassword', param);
};

export const updateAdminPassword = (param) => {
    return service.post('/api/admin/user/updatePassword', param);
};